#include <iostream>
#include <cmath>
bool isPrime(int num) {
    if (num < 2) return false;
    for (int i = 2; i <= std::sqrt(num); ++i) {
        if (num % i == 0) return false;
    }
    return true;
}
void checkSexyPrime(int N) {
    if (isPrime(N)) {
        if (isPrime(N - 6)) {
            std::cout << "Yes" << std::endl;
            std::cout << N - 6 << std::endl;
            return;
        }
        if (isPrime(N + 6)) {
            std::cout << "Yes" << std::endl;
            std::cout << N + 6 << std::endl;
            return;
        }
    }
    for (int i = N + 1; ; ++i) {
        if (isPrime(i)) {
            if (isPrime(i - 6) || isPrime(i + 6)) {
                std::cout << "No" << std::endl;
                std::cout << i << std::endl;
                return;
            }
        }
    }
}

int main() {
    int N;
    std::cin >> N;
    checkSexyPrime(N);
    return 0;
}    